package cn.tedu.controller;

import cn.tedu.pojo.ApplicationForm;
import cn.tedu.pojo.Chapter;
import cn.tedu.service.ApplicationFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class ApplicationFormController {
    @Autowired
    private ApplicationFormService applicationFormService;

    //作者角色申请及小说发表申请
    @PutMapping("/roleAndNovelApplication")
    public void roleAndNovelApplication(@RequestBody ApplicationForm applicationForm){
        applicationFormService.roleAndNovelApplication(applicationForm);
    }

    //小说章节核审,返回小说书名
    @PutMapping("/chapterApplication")
    public String chapterApplication(@RequestBody Chapter chapter){
        String novelName = applicationFormService.chapterApplication(chapter);
        return novelName;
    }

    //获取编辑返回信息后发送信息
    @GetMapping("/getEditorToAuthor")
    public ApplicationForm getEditToAuthor(@RequestParam("author") String author){
        ApplicationForm applicationForm = applicationFormService.getEditorToAuthor(author);
        return applicationForm;
    }
}
